package chapter06.Example07;

import java.util.HashSet;
import java.util.Iterator;

public class Example07 {
    public static void main(String[] args){
        HashSet set = new HashSet();
        set.add("罗翔");
        set.add("马庆");
        set.add("爱玩");
        set.add("原神");
        set.add("爱玩");//加个相同对象
        System.out.println(set);
        Iterator it = set.iterator();//返回迭代器
        while (it.hasNext()){
            Object obj = it.next();
            System.out.println(obj);
        }
    }
}
